﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Base;
using Agent;

/// <summary>
/// 添加加盟子类别
/// </summary>

public partial class admin_Agent_AgentTypeAdd : BasePage
{
    protected void Page_Load(object sender, EventArgs e)//页面加载事件
    {
        CheckRights("column", "E1");
    }

    protected void btnSave_Click(object sender, EventArgs e)//添加子类别事件
    {
        try
        {
            int ParentID=0;
            if (Request.QueryString["ParentID"] != null && Request.QueryString["ParentID"]!="" )
            {
                ParentID = int.Parse(Request.QueryString["ParentID"]);
            }
            TAgentType TAgent = new TAgentType();
            TAgent.Name = txtName.Text;
            TAgent.ParentID = ParentID;
            IAgentType RAgent = new RAgentType();
            RAgent.Insert(TAgent);
            ShowMessage("类名添加成功！","Agent/AgentTypeList.aspx");
        }
        catch (Exception ex)
        {
            ShowMessage("类名添加失败!", "Agent/AgentTypeList.aspx");
        }
    }

    protected void btnCancel_Click(object sender, EventArgs e)//取消操作事件
    {
        Response.Write("<script language=javascript>window.location.href='AgentTypeList.aspx'</script>");
    }
}
